package cool.webstudy.admin.controller.file;

import cool.webstudy.admin.model.vo.file.UploadFileVO;
import cool.webstudy.admin.service.FileRecordService;
import cool.webstudy.admin.utils.aspect.request.RequestParameterCheck;
import cool.webstudy.admin.utils.common.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@Tag(name = "文件管理")
@RestController
@RequestMapping("/file")
@RequestParameterCheck
public class FileRecordController {
    @Autowired
    private FileRecordService fileRecordService;
    @PostMapping("/upload")
    @Operation(summary = "上传文件接口")
    public Result uploadFile(@RequestPart("file") MultipartFile file) {
        UploadFileVO vo = fileRecordService.uploadFile(file);
        return Result.success(vo);
    }
}
